export const getUserByName = `select
  userid,
  username,
  company_id as companyId,
  company_name as companyName,
  org_id as orgId,
  org_name as orgName,
  empno,
  gender,
  atavar,
  phone,
  job_title as jobTitle,
  email,
  role,
  auth_status as authStatus,
  hiredate,
  date_format(create_time, '%Y-%m-%d %H:%m:%s') as createTime
  from user
  where username = :username and password = :password
`;
export const getUserById = `select
  userid,
  username,
  company_id as companyId,
  company_name as companyName,
  org_id as orgId,
  org_name as orgName,
  empno,
  gender,
  atavar,
  phone,
  job_title as jobTitle,
  email,
  role,
  auth_status as authStatus,
  hiredate,
  date_format(create_time, '%Y-%m-%d %H:%m:%s') as createTime
  from user
  where userid = :userid
`;
export const getUserListByDept = `select
  userid,
  username,
  company_id as companyId,
  company_name as companyName,
  org_id as orgId,
  org_name as orgName,
  empno,
  gender,
  atavar,
  phone,
  job_title as jobTitle,
  email,
  role,
  auth_status as authStatus,
  hiredate,
  date_format(create_time, '%Y-%m-%d %H:%m:%s') as createTime
  from user
  where p_delete = 0 and org_id = :orgId
`;
export const registerCompany = `insert into company
  (company_id, company_name, scale, location)
  values (:companyId, :companyName, :scale, :location)
`;
export const register = `insert into user
  (userid, username, password, company_id, company_name, org_id, org_name, role, auth_status)
  values (:userid, :username, :password, :companyId, :companyName, :orgId, :orgName, :role, :authStatus)
`;
export const dimission = `update user set
  p_delete = 1
  where userid = :userid
`;
export const create = `insert into user
  (userid, username, password, gender, phone, email, org_id, role, empno, job_title, hiredate)
  values (:userid, :username, :password, :gender, :phone, :email, :orgId, :role, :empno, :jobTitle, :hiredate)
`;
export const save = `update user set
  username = :username,
  gender = :gender,
  phone = :phone,
  email = :email,
  org_id = :orgId,
  role = :role,
  empno = :empno,
  job_title = :jobTitle,
  hiredate = :hiredate
  where userid = :userid
`;
export const createRootOrg = `insert into organization
  (org_id, org_name, parent_id, org_manage)
  values (:orgId, :orgName, :parentId, :orgManage)
`;
